package by.bucha.testproject.adapters;

import java.util.List;

import by.bucha.testproject.fragments.FullScreenImageFragment;
import by.bucha.testproject.imageLoader.ExternalFileCache;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class FullScreenImageAdapter extends FragmentPagerAdapter {

	public FullScreenImageAdapter(FragmentManager fm) {
		super(fm);
		mData = ExternalFileCache.getInstance().getFilePathes();
	}

	private List<String> mData;

	@Override
	public Fragment getItem(int item) {
		if (getCount() != 0) {
			FullScreenImageFragment content = new FullScreenImageFragment();
			Bundle arguments = new Bundle();

			String puth = mData.get(item);
			arguments.putString(FullScreenImageFragment.EXTRA_PHOTO_PATH, puth);
			content.setArguments(arguments);
			return content;
		}
		return null;
	}

	@Override
	public int getCount() {
		int count = mData.size();
		return count;
	}

}
